{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "ee_ImageCollection.ipynb",
      "version": "0.3.2",
      "provenance": [],
      "collapsed_sections": [
        "wn46CWeD1fj8",
        "WZzMDoNFMQqj",
        "46iNcZViMhuq",
        "SRN5w_VqNRUU",
        "ufMTpJqnOWM5",
        "_2V04dYAPKQ-"
      ],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "tXmKdAR44woN",
        "colab_type": "text"
      },
      "source": [
        "<!--COURSE_INFORMATION-->\n",
        "<img align=\"left\" style=\"padding-right:10px;\" src=\"https://sitejerk.com/images/google-earth-logo-png-5.png\" width=5% >\n",
        "<img align=\"right\" style=\"padding-left:10px;\" src=\"https://colab.research.google.com/img/colab_favicon_256px.png\" width=6% >\n",
        "\n",
        "\n",
        ">> *This notebook is part of the free course [EEwPython](https://colab.research.google.com/github/csaybar/EEwPython/blob/master/index.ipynb); the content is available [on GitHub](https://github.com/csaybar/EEwPython)* and released under the [Apache 2.0 License](https://www.gnu.org/licenses/gpl-3.0.en.html). 99% of this material has been adapted from [Google Earth Engine Guides](https://developers.google.com/earth-engine/)."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "VxoENq0D4yOU",
        "colab_type": "text"
      },
      "source": [
        "<!--NAVIGATION-->\n",
        " < [Image](2_eeImage.ipynb) | [Contents](index.ipynb) |  [Geometry, Feature and FeatureCollection](4_features.ipynb)>\n",
        "\n",
        "<a href=\"https://colab.research.google.com/github/csaybar/EEwPython/blob/master/3_eeImageCollection.ipynb\"><img align=\"left\" src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open in Colab\" title=\"Open and Execute in Google Colaboratory\"></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "c1tBPR2840vC",
        "colab_type": "text"
      },
      "source": [
        "<center>\n",
        "<h1>Google Earth Engine with Python </h1>\n",
        "<h2> ee.ImageCollection</h2>\n",
        "</center>\n",
        "<h2> Topics:</h2>\n",
        "\n",
        "1. ImageCollection Overview\n",
        "2. ImageCollection Information and Metadata\n",
        "3. Filtering and ImageCollection\n",
        "4. Mapping over an ImageCollection\n",
        "5. Reducing an ImageCollection\n",
        "6. Compositing and Mosaicking\n",
        "7. Iterating over an ImageCollection\n",
        "\n",
        "\n",
        "An **ImageCollection** is a stack or time series of images. In addition to loading an **ImageCollection** using an Earth Engine collection ID, Earth Engine has methods to create image collections. The constructor **ee.ImageCollection()** or the convenience method **ee.ImageCollection.fromImages()** create image collections from lists of images. You can also create new image collections by merging existing collections."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "WZzMDoNFMQqj",
        "colab_type": "text"
      },
      "source": [
        "## Connecting GEE with Google Services"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "yg5yf4UeMUNp",
        "colab_type": "text"
      },
      "source": [
        "- **Authenticate to Earth Engine**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "yjagNoA5MVyu",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "!pip install earthengine-api #earth-engine Python API"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "WJ12x_C7-50C",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "!earthengine authenticate "
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "HytVVE3PMYYB",
        "colab_type": "text"
      },
      "source": [
        "- **Authenticate to Google Drive (OPTIONAL)**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Lb1cz-lZMaYB",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from google.colab import drive\n",
        "drive.mount('/content/drive')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "soMXU2b_-_Ld",
        "colab_type": "text"
      },
      "source": [
        "- **Authenticate to Google Cloud (OPTIONAL)**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "s3wGdcS6Mdui",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from google.colab import auth\n",
        "auth.authenticate_user()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "D7oVKyC9_Df8",
        "colab_type": "text"
      },
      "source": [
        "## Testing the software setup\n",
        "\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "6qMxZxObMjhj",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Earth Engine Python API\n",
        "import ee\n",
        "ee.Initialize()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "GNl2kZtm_JA6",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "5959e4a7-8136-4d7d-bb2d-287719a41908"
      },
      "source": [
        "import folium\n",
        "\n",
        "# Define the URL format used for Earth Engine generated map tiles.\n",
        "EE_TILES = 'https://earthengine.googleapis.com/map/{mapid}/{{z}}/{{x}}/{{y}}?token={token}'\n",
        "\n",
        "print('Folium version: ' + folium.__version__)"
      ],
      "execution_count": 4,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Folium version: 0.8.3\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "t2tnEtGVMk2y",
        "colab_type": "code",
        "colab": {},
        "cellView": "form"
      },
      "source": [
        "#@title Mapdisplay: Display GEE objects using folium.\n",
        "def Mapdisplay(center, dicc, Tiles=\"OpensTreetMap\",zoom_start=10):\n",
        "    '''\n",
        "    :param center: Center of the map (Latitude and Longitude).\n",
        "    :param dicc: Earth Engine Geometries or Tiles dictionary\n",
        "    :param Tiles: Mapbox Bright,Mapbox Control Room,Stamen Terrain,Stamen Toner,stamenwatercolor,cartodbpositron.\n",
        "    :zoom_start: Initial zoom level for the map.\n",
        "    :return: A folium.Map object.\n",
        "    '''\n",
        "    mapViz = folium.Map(location=center,tiles=Tiles, zoom_start=zoom_start)\n",
        "    for k,v in dicc.items():\n",
        "      if ee.image.Image in [type(x) for x in v.values()]:\n",
        "        folium.TileLayer(\n",
        "            tiles = EE_TILES.format(**v),\n",
        "            attr  = 'Google Earth Engine',\n",
        "            overlay =True,\n",
        "            name  = k\n",
        "          ).add_to(mapViz)\n",
        "      else:\n",
        "        folium.GeoJson(\n",
        "        data = v,\n",
        "        name = k\n",
        "          ).add_to(mapViz)\n",
        "    mapViz.add_child(folium.LayerControl())\n",
        "    return mapViz"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "46iNcZViMhuq",
        "colab_type": "text"
      },
      "source": [
        "# 1. Image Collection Overview\n",
        "\n",
        "An `ImageCollection` is a **stack or time series of images**. In addition to loading an `ImageCollection` using an Earth Engine collection ID, Earth Engine has methods to create image collections. The constructor `ee.ImageCollection()` or the convenience method `ee.ImageCollection.fromImages()` create image collections from lists of images. You can also create new image collections by merging existing collections. For example:\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "2MAaHWtYM20R",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Create arbitrary constant images.\n",
        "constant1 = ee.Image(1)\n",
        "constant2 = ee.Image(2)\n",
        "\n",
        "# Create a collection by giving a list to the constructor.\n",
        "collectionFromConstructor = ee.ImageCollection([constant1, constant2])\n",
        "print('collectionFromConstructor: ')\n",
        "collectionFromConstructor.getInfo()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "zq-2wOYAM7bw",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Create a collection with fromImages().\n",
        "collectionFromImages = ee.ImageCollection.fromImages([ee.Image(3), ee.Image(4)])\n",
        "print('collectionFromImages: ')\n",
        "collectionFromImages.getInfo()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Rz3D_elIM8tA",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Merge two collections.\n",
        "mergedCollection = collectionFromConstructor.merge(collectionFromImages)\n",
        "print('mergedCollection: ')\n",
        "mergedCollection.getInfo()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "f1geuu5fM-Eg",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Create a toy FeatureCollection\n",
        "features = ee.FeatureCollection(\n",
        "  [ee.Feature(None, {'foo': 1}), ee.Feature(None, {'foo': 2})])\n",
        "\n",
        "# Create an ImageCollection from the FeatureCollection\n",
        "# by mapping a function over the FeatureCollection.\n",
        "images = features.map(lambda feature:ee.Image(ee.Number(feature.get('foo'))))\n",
        "\n",
        "# Print the resultant collection.\n",
        "print('Image collection: ')\n",
        "images.getInfo()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "WdRjFVu_M_4f",
        "colab_type": "text"
      },
      "source": [
        "Note that in this example an `ImageCollection` is created by mapping a function that returns an `Image` over a `FeatureCollection`. Learn more about mapping in the [Mapping over an ImageCollection section](https://developers.google.com/earth-engine/ic_mapping). Learn more about feature collections from the [FeatureCollection section](https://developers.google.com/earth-engine/feature_collections)."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "SRN5w_VqNRUU",
        "colab_type": "text"
      },
      "source": [
        "# 2. ImageCollection Information and Metadata\n",
        "\n",
        "As with Images, there are a variety of ways to get information about an ImageCollection. The collection can be printed directly to the console, but the console printout is **limited to 5000 elements**. Collections larger than 5000 images will need to be filtered before printing. Printing a large collection will be correspondingly slower. The following example shows various ways of getting information about image collections programmatically."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "nxPzqAbzM9-O",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Load a Landsat 8 ImageCollection for a single path-row.\n",
        "collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')\\\n",
        "               .filter(ee.Filter.eq('WRS_PATH', 44))\\\n",
        "               .filter(ee.Filter.eq('WRS_ROW', 34))\\\n",
        "               .filterDate('2014-03-01', '2014-08-01')\n",
        "print('Collection: ')\n",
        "collection.getInfo()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "zaAPnGOmNQFx",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Get the number of images.\n",
        "count = collection.size()\n",
        "print('Count: ', count.getInfo())"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "rPeedHOqNas0",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from datetime import datetime as dt\n",
        "# Get the date range of images in the collection.\n",
        "rango = collection.reduceColumns(ee.Reducer.minMax(), [\"system:time_start\"])\n",
        "\n",
        "# Passing numeric date to standard\n",
        "init_date = ee.Date(rango.get('min')).getInfo()['value']/1000.\n",
        "init_date_f = dt.utcfromtimestamp(init_date).strftime('%Y-%m-%d %H:%M:%S')\n",
        "\n",
        "last_date = ee.Date(rango.get('max')).getInfo()['value']/1000.\n",
        "last_date_f = dt.utcfromtimestamp(last_date).strftime('%Y-%m-%d %H:%M:%S')\n",
        "\n",
        "print('Date range: ',init_date_f,' - ',last_date_f)"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "wLR8A8MTNb8D",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Get statistics for a property of the images in the collection.\n",
        "sunStats = collection.aggregate_stats('SUN_ELEVATION')\n",
        "print('Sun elevation statistics: ')\n",
        "sunStats.getInfo()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "tYTTGwxPNdH8",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Sort by a cloud cover property, get the least cloudy image.\n",
        "image = ee.Image(collection.sort('CLOUD_COVER').first())\n",
        "print('Least cloudy image: ', )\n",
        "image.getInfo()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "6N9uTHsnNeGU",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Limit the collection to the 10 most recent images.\n",
        "recent = collection.sort('system:time_start', False).limit(10)\n",
        "print('Recent images: ')\n",
        "recent.getInfo()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ufMTpJqnOWM5",
        "colab_type": "text"
      },
      "source": [
        "# 3. Filtering an ImageCollection\n",
        "\n",
        "As illustrated in the Get Started section and the ImageCollection Information section, Earth Engine provides a variety of convenience methods for filtering image collections. Specifically, many common use cases are handled by **imageCollection.filterDate()**, and **imageCollection.filterBounds()**. For general purpose filtering, use **imageCollection.filter()** with an **ee.Filter** as an argument. The following example demonstrates both convenience methods and **filter()** to identify and remove images with bad registration from an **ImageCollection**."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "gtahWxaDPN8W",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 690
        },
        "outputId": "ce981d7d-39ac-4f28-bcb4-5089bb40fcbf"
      },
      "source": [
        "# Load Landsat 5 data, filter by date and bounds.\n",
        "collection = ee.ImageCollection('LANDSAT/LT05/C01/T2').filterDate('1987-01-01', '1990-05-01').filterBounds(ee.Geometry.Point(25.8544, -18.08874))\n",
        "\n",
        "# Also filter the collection by the IMAGE_QUALITY property.\n",
        "filtered = collection.filterMetadata('IMAGE_QUALITY', 'equals', 9)\n",
        "\n",
        "# Create two composites to check the effect of filtering by IMAGE_QUALITY.\n",
        "badComposite = ee.Algorithms.Landsat.simpleComposite(collection, 75, 3)\n",
        "goodComposite = ee.Algorithms.Landsat.simpleComposite(filtered, 75, 3)\n",
        "\n",
        "dicc = {\n",
        "    'Bad composite' : badComposite.getMapId({'bands': ['B3', 'B2', 'B1'], 'gain': 3.5}),\n",
        "    'Good composite': goodComposite.getMapId({'bands': ['B3', 'B2', 'B1'], 'gain': 3.5})\n",
        "}\n",
        "\n",
        "# Display the results\n",
        "center = [-18.08874, 25.8544]\n",
        "Mapdisplay(center, dicc, zoom_start= 13)"
      ],
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktMS4xMi40Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogIC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MjgxZmY2MzRmY2ZhMTUxYjAxYTdkYTU2ZjY3LCJHb29kIGNvbXBvc2l0ZSIgOiB0aWxlX2xheWVyXzNkZDU2ZmMyZDBkOTRmNWQ4MDM0ZWNkZWJmOWNmMTIxLCB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBMLmNvbnRyb2wubGF5ZXJzKAogICAgICAgICAgICAgICAgbGF5ZXJfY29udHJvbF84ZDI1YjkzNzMxZGU0N2I0YjM4MWQxN2EwZTg5YzkwNy5iYXNlX2xheWVycywKICAgICAgICAgICAgICAgIGxheWVyX2NvbnRyb2xfOGQyNWI5MzczMWRlNDdiNGIzODFkMTdhMGU4OWM5MDcub3ZlcmxheXMsCiAgICAgICAgICAgICAgICB7cG9zaXRpb246ICd0b3ByaWdodCcsCiAgICAgICAgICAgICAgICAgY29sbGFwc2VkOiB0cnVlLAogICAgICAgICAgICAgICAgIGF1dG9aSW5kZXg6IHRydWUKICAgICAgICAgICAgICAgIH0pLmFkZFRvKG1hcF9iYmY5MTViMTI5YmI0MjU4OTI3MmE4YjQ3MWZmNmQxMyk7CiAgICAgICAgICAgIAogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f09739bb080>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 7
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "YO-IRM-nRDAa",
        "colab_type": "text"
      },
      "source": [
        "# 4. Mapping over an ImageCollection\n",
        "\n",
        "To apply a function to every Image in an ImageCollection use imageCollection.map(). The only argument to map() is a function which takes one parameter: an ee.Image. For example, the following code adds a timestamp band to every image in the collection."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "YV008t1pRIoT",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "from pprint import pprint\n",
        "# Load a Landsat 8 collection for a single path-row.\n",
        "collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA').filter(ee.Filter.eq('WRS_PATH', 44)).filter(ee.Filter.eq('WRS_ROW', 34))\n",
        "\n",
        "# This function adds a band representing the image timestamp.\n",
        "def addTime(image):\n",
        "\treturn image.addBands(image.metadata('system:time_start'))\n",
        "\n",
        "# Map the function over the collection and display the result.\n",
        "pprint(collection.map(addTime).limit(3).getInfo())"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ZXxc82LqRq0B",
        "colab_type": "text"
      },
      "source": [
        "Note that in the predefined function, the **metadata()** method is used to create a new Image from the value of a property. As discussed in the *Reducing* and *Compositing* sections, having that time band is useful for the linear modeling of change and for making composites.\n",
        "\n",
        "The mapped function is limited in the operations it can perform. Specifically, it can’t modify variables outside the function; it can’t print anything; it can’t use JavaScript ‘if’ or ‘for’ statements. However, you can use **ee.Algorithms.If()** to perform conditional operations in a mapped function."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "FBhel41HR02L",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Load a Landsat 8 collection for a single path-row.\n",
        "collection = ee.ImageCollection('LANDSAT/LC8_L1T_TOA').filter(ee.Filter.eq('WRS_PATH', 44)).filter(ee.Filter.eq('WRS_ROW', 34))\n",
        "\n",
        "# This function uses a conditional statement to return the image if\n",
        "# the solar elevation > 40 degrees.  Otherwise it returns a zero image.\n",
        "def conditional(image):\n",
        "\treturn ee.Algorithms.If(ee.Number(image.get('SUN_ELEVATION')).gt(40), image, ee.Image(0))\n",
        "\n",
        "# Map the function over the collection, convert to a List and print the result.\n",
        "print('Expand this to see the result: ')\n",
        "pprint(collection.map(conditional).limit(3).getInfo())"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "jsp-ucH2Sna6",
        "colab_type": "text"
      },
      "source": [
        "Inspect the list of images in the output ImageCollection and note that the when the condition evaluated by the **If()** algorithm is true, the output contains a constant image. Although this demonstrates a server-side conditional function (learn more about client vs. server in Earth Engine on this page), avoid **If()** in general and use filters instead."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3SWzt2T0S5Jt",
        "colab_type": "text"
      },
      "source": [
        "# 5. Reducing an ImageCollection\n",
        "\n",
        "To composite images in an **ImageCollection**, use **imageCollection.reduce()**. This will composite all the images in the collection to a single image representing, for example, the min, max, mean or standard deviation of the images. (See the Reducers section for more information about reducers). For example, to create a median value image from a collection:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "odhdIiJ7TDzP",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 690
        },
        "outputId": "ff87449e-fb1a-4a8c-93ec-c3af680385d4"
      },
      "source": [
        "# Load a Landsat 8 collection for a single path-row.\n",
        "collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA').filter(ee.Filter.eq('WRS_PATH', 44)).filter(ee.Filter.eq('WRS_ROW', 34)).filterDate('2014-01-01', '2015-01-01')\n",
        "\n",
        "# Compute a median image and display.\n",
        "median = collection.median()\n",
        "\n",
        "dicc = {\n",
        "    'median' : median.getMapId({'bands': ['B4', 'B3', 'B2'], 'max': 0.3})\n",
        "}\n",
        "\n",
        "# Display the results\n",
        "center = [37.7726, -122.3578]\n",
        "Mapdisplay(center, dicc, zoom_start= 12)"
      ],
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7I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AgICAgICAgIEwuY29udHJvbC5sYXllcnMoCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzE0OTc0ZGQzZDA3YjQ5NzFiMjQyMzE1ODVjZDA4MTNhLmJhc2VfbGF5ZXJzLAogICAgICAgICAgICAgICAgbGF5ZXJfY29udHJvbF8xNDk3NGRkM2QwN2I0OTcxYjI0MjMxNTg1Y2QwODEzYS5vdmVybGF5cywKICAgICAgICAgICAgICAgIHtwb3NpdGlvbjogJ3RvcHJpZ2h0JywKICAgICAgICAgICAgICAgICBjb2xsYXBzZWQ6IHRydWUsCiAgICAgICAgICAgICAgICAgYXV0b1pJbmRleDogdHJ1ZQogICAgICAgICAgICAgICAgfSkuYWRkVG8obWFwXzlkMjk0ZDljMTkwNTQwNDQ5MjkxMTQwOWM3MzhkOTgwKTsKICAgICAgICAgICAgCiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f0972f566d8>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 8
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "wPMy5STKTjmN",
        "colab_type": "text"
      },
      "source": [
        "At each location in the output image, in each band, the pixel value is the median of all unmasked pixels in the input imagery (the images in the collection). In the previous example, median() is a convenience method for the following call:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "UJc6NK2AT8I5",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 690
        },
        "outputId": "17c71ef8-36a1-4fd7-ddad-77bd9ab54145"
      },
      "source": [
        "# Reduce the collection with a median reducer.\n",
        "median = collection.reduce(ee.Reducer.median())\n",
        "\n",
        "# Display the median image.\n",
        "dicc = {'also median' : median.getMapId({'bands': ['B4_median', 'B3_median', 'B2_median'], 'max': 0.3})}\n",
        "\n",
        "# Display the results\n",
        "center = [37.7726, -122.3578]\n",
        "Mapdisplay(center, dicc, zoom_start= 12)"
      ],
      "execution_count": 18,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktMS4xMi40Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogIC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VhOCk7CiAgICAKICAgICAgICAgICAgdmFyIGxheWVyX2NvbnRyb2xfODlmMmY3Mjk4MWViNDAxNTg1NGIwMGUxYWQzM2M1MDAgPSB7CiAgICAgICAgICAgICAgICBiYXNlX2xheWVycyA6IHsgIm9wZW5zdHJlZXRtYXAiIDogdGlsZV9sYXllcl9hOWE2N2JjNmI5ZWE0M2JkODdiZDVkMjhkYjk4Nzg3MiwgfSwKICAgICAgICAgICAgICAgIG92ZXJsYXlzIDogeyAiYWxzbyBtZWRpYW4iIDogdGlsZV9sYXllcl9hOWU4YzM5MDE2Y2I0YTk5YTBjMGFmOTU0YWY0ZjM1OSwgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgTC5jb250cm9sLmxheWVycygKICAgICAgICAgICAgICAgIGxheWVyX2NvbnRyb2xfODlmMmY3Mjk4MWViNDAxNTg1NGIwMGUxYWQzM2M1MDAuYmFzZV9sYXllcnMsCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzg5ZjJmNzI5ODFlYjQwMTU4NTRiMDBlMWFkMzNjNTAwLm92ZXJsYXlzLAogICAgICAgICAgICAgICAge3Bvc2l0aW9uOiAndG9wcmlnaHQnLAogICAgICAgICAgICAgICAgIGNvbGxhcHNlZDogdHJ1ZSwKICAgICAgICAgICAgICAgICBhdXRvWkluZGV4OiB0cnVlCiAgICAgICAgICAgICAgICB9KS5hZGRUbyhtYXBfZDBiM2I3Y2U3NjNlNDI4NGI2MDdmYzE0MWJlYWM1YTgpOwogICAgICAgICAgICAKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f09739c5780>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 18
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "PLEcUs_vUI9L",
        "colab_type": "text"
      },
      "source": [
        "Note that the band names differ as a result of using reduce() instead of the convenience method. Specifically, the names of the reducer have been appended to the band names.\n",
        "\n",
        "More complex reductions are also possible using reduce(). For example, to compute the long term linear trend over a collection, use one of the linear regression reducers. The following code computes the linear trend of MODIS Enhanced Vegetation Index (EVI)."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "d_3oQp-fUK3l",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 690
        },
        "outputId": "dada076a-bba2-49a6-ac6c-3a59150eb30c"
      },
      "source": [
        "# This function adds a band representing the image timestamp.\n",
        "def addTime(image):\n",
        "  return image.addBands(image.metadata('system:time_start').divide(1000 * 60 * 60 * 24 * 365))\n",
        "\n",
        "# Load a MODIS collection, filter to several years of 16 day mosaics, and map the time band function over it.\n",
        "collection = ee.ImageCollection('MODIS/006/MYD13A1').filterDate('2004-01-01', '2010-10-31').map(addTime)\n",
        "\n",
        "# Select the bands to model with the independent variable first.\n",
        "# Compute the linear trend over time.\n",
        "trend = collection.select(['system:time_start', 'EVI']).reduce(ee.Reducer.linearFit())\n",
        "\n",
        "# Display the trend with increasing slopes in green, decreasing in red.\n",
        "dicc = {\n",
        "    'EVI trend' : trend.getMapId({'min': 0, 'max': [-100, 100, 10000], 'bands': ['scale', 'scale', 'offset']})\n",
        "}\n",
        "\n",
        "# Display the results\n",
        "center = [39.436, -96.943]\n",
        "Mapdisplay(center, dicc, zoom_start= 5)"
      ],
      "execution_count": 19,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQ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ICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgTC5jb250cm9sLmxheWVycygKICAgICAgICAgICAgICAgIGxheWVyX2NvbnRyb2xfNWY0NzVlM2M3MzIxNGQ5M2EyMDJmNzYyMzZhNWFmZTcuYmFzZV9sYXllcnMsCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzVmNDc1ZTNjNzMyMTRkOTNhMjAyZjc2MjM2YTVhZmU3Lm92ZXJsYXlzLAogICAgICAgICAgICAgICAge3Bvc2l0aW9uOiAndG9wcmlnaHQnLAogICAgICAgICAgICAgICAgIGNvbGxhcHNlZDogdHJ1ZSwKICAgICAgICAgICAgICAgICBhdXRvWkluZGV4OiB0cnVlCiAgICAgICAgICAgICAgICB9KS5hZGRUbyhtYXBfMzIyMjRlM2IxODcyNGE0ZGI5NjRmZGIyMDM5OTIzNTUpOwogICAgICAgICAgICAKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f0972cc5f60>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 19
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "WdSBilTMVhVh",
        "colab_type": "text"
      },
      "source": [
        "Note that the output of the reduction in this example is a two banded image with one band for the slope of a linear regression (**scale**) and one band for the intercept (**offset**). Explore the API documentation to see a list of the reducers that are available to reduce an **ImageCollection** to a single Image. See the **ImageCollection.reduce()** section for more information about reducing image collections.\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "_2V04dYAPKQ-",
        "colab_type": "text"
      },
      "source": [
        "# 6. Compositing and Mosaicking\n",
        "\n",
        "In general, compositing refers to the process of combining spatially overlapping images into a single image based on an aggregation function. Mosaicking refers to the process of spatially assembling image datasets to produce a spatially continuous image. In Earth Engine, these terms are used interchangeably, though both compositing and mosaicking are supported. For example, consider the task of compositing multiple images in the same location. For example, using one National Agriculture Imagery Program (NAIP) Digital Orthophoto Quarter Quadrangle (DOQQ) at different times, the following example demonstrates making a maximum value composite:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "etFzTV26C4nK",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 690
        },
        "outputId": "cff85610-14fb-4a7a-b7dd-a377f3e5a087"
      },
      "source": [
        "# Load three NAIP quarter quads in the same location, different times.\n",
        "naip2004_2012 = ee.ImageCollection('USDA/NAIP/DOQQ')\\\n",
        "                  .filterBounds(ee.Geometry.Point(-71.08841, 42.39823))\\\n",
        "                  .filterDate('2004-07-01', '2012-12-31')\\\n",
        "                  .select(['R', 'G', 'B'])\n",
        "\n",
        "# Temporally composite the images with a maximum value function.\n",
        "composite = naip2004_2012.max()\n",
        "center = [42.3712, -71.12532]\n",
        "Mapdisplay(center, {'max value composite':composite.getMapId()},zoom_start=12)"
      ],
      "execution_count": 22,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NvZGUuanF1ZXJ5LmNvbS9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xheXMsCiAgICAgICAgICAgICAgICB7cG9zaXRpb246ICd0b3ByaWdodCcsCiAgICAgICAgICAgICAgICAgY29sbGFwc2VkOiB0cnVlLAogICAgICAgICAgICAgICAgIGF1dG9aSW5kZXg6IHRydWUKICAgICAgICAgICAgICAgIH0pLmFkZFRvKG1hcF9lYzM5YmIzMmJjYzI0N2Y4OTg4MTUwZDg4ZGMwYzUxZSk7CiAgICAgICAgICAgIAogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f0972ca4d30>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 22
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "xffZMit6DjAq",
        "colab_type": "text"
      },
      "source": [
        "Consider the need to mosaic four different DOQQs at the same time, but different locations. The following example demonstrates that using **imageCollection.mosaic()**:\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "jyr0erpiDmP0",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 690
        },
        "outputId": "96198434-0990-475c-bfbf-35cf1e68a29e"
      },
      "source": [
        "# Load four 2012 NAIP quarter quads, different locations.\n",
        "naip2012 = ee.ImageCollection('USDA/NAIP/DOQQ')\\\n",
        "             .filterBounds(ee.Geometry.Rectangle(-71.17965, 42.35125, -71.08824, 42.40584))\\\n",
        "             .filterDate('2012-01-01', '2012-12-31')\n",
        "\n",
        "# Spatially mosaic the images in the collection and display.\n",
        "mosaic = naip2012.mosaic()\n",
        "center = [42.3712,-71.12532]\n",
        "Mapdisplay(center,{'spatial mosaic':mosaic.getMapId()},zoom_start=12)"
      ],
      "execution_count": 23,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom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XRtYXAiIDogdGlsZV9sYXllcl8zY2MxOWU5Yzc4NTU0NjRjODUyOTY0NjY5ZjhjNDk3MSwgfSwKICAgICAgICAgICAgICAgIG92ZXJsYXlzIDogeyAic3BhdGlhbCBtb3NhaWMiIDogdGlsZV9sYXllcl81M2RjOGVjOWNmNDE0MTExOGIxYThkNzI2YjM3Mjk5NSwgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgTC5jb250cm9sLmxheWVycygKICAgICAgICAgICAgICAgIGxheWVyX2NvbnRyb2xfMTMxYjhmZTkzZTBmNDNhNjliMDM1MmE0OWFkMTM4ZDcuYmFzZV9sYXllcnMsCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzEzMWI4ZmU5M2UwZjQzYTY5YjAzNTJhNDlhZDEzOGQ3Lm92ZXJsYXlzLAogICAgICAgICAgICAgICAge3Bvc2l0aW9uOiAndG9wcmlnaHQnLAogICAgICAgICAgICAgICAgIGNvbGxhcHNlZDogdHJ1ZSwKICAgICAgICAgICAgICAgICBhdXRvWkluZGV4OiB0cnVlCiAgICAgICAgICAgICAgICB9KS5hZGRUbyhtYXBfYWFlNzI5ZjBkYTA0NDVlMGFkNWJmZWZjZmRlYmNiNWQpOwogICAgICAgICAgICAKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f0972f16080>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 23
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "P-gUjGwpD8S1",
        "colab_type": "text"
      },
      "source": [
        "Note that there is some overlap in the DOQQs in the previous example. The **mosaic()** method composites overlapping images according to their order in the collection (last on top). To control the source of pixels in a mosaic (or a composite), use image masks. For example, the following uses thresholds on spectral indices to mask the image data in a mosaic:\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "0j_e-HVpEAi2",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 700
        },
        "outputId": "5de4b747-e90e-456d-e7e3-ff9c924332ba"
      },
      "source": [
        "# Load a NAIP quarter quad, display.\n",
        "naip = ee.Image('USDA/NAIP/DOQQ/m_4207148_nw_19_1_20120710')\n",
        "\n",
        "# Create the NDVI and NDWI spectral indices.\n",
        "ndvi = naip.normalizedDifference(['N', 'R'])\n",
        "ndwi = naip.normalizedDifference(['G', 'N'])\n",
        "\n",
        "# Create some binary images from thresholds on the indices.\n",
        "# This threshold is designed to detect bare land.\n",
        "bare1 = ndvi.lt(0.2).And(ndwi.lt(0.3))\n",
        "# This detects bare land with lower sensitivity. It also detects shadows.\n",
        "bare2 = ndvi.lt(0.2).And(ndwi.lt(0.8));\n",
        "\n",
        "# Define visualization parameters for the spectral indices.\n",
        "ndviViz = {'min': -1, 'max': 1, 'palette': ['FF0000', '00FF00']}\n",
        "ndwiViz = {'min': 0.5, 'max': 1, 'palette': ['00FFFF', '0000FF']}\n",
        "\n",
        "# Mask and mosaic visualization images.  The last layer is on top.\n",
        "mosaic = ee.ImageCollection([\n",
        "  # NDWI > 0.5 is water.  Visualize it with a blue palette.\n",
        "  ndwi.updateMask(ndwi.gte(0.5)).visualize(**ndwiViz),\n",
        "  # NDVI > 0.2 is vegetation.  Visualize it with a green palette.\n",
        "  ndvi.updateMask(ndvi.gte(0.2)).visualize(**ndviViz),\n",
        "  # Visualize bare areas with shadow (bare2 but not bare1) as gray.\n",
        "  bare2.updateMask(bare2.And(bare1.Not())).visualize(**{'palette': ['AAAAAA']}),\n",
        "  # Visualize the other bare areas as white.\n",
        "  bare1.updateMask(bare1).visualize(**{'palette': ['FFFFFF']}),\n",
        "]).mosaic()\n",
        "\n",
        "center = [42.3443, -71.0915]\n",
        "dicc = {'NAIP DOQQ':naip.getMapId(),\n",
        "        'Visualization mosaic':mosaic.getMapId()}\n",
        "Mapdisplay(center,dicc,zoom_start=14)   "
      ],
      "execution_count": 49,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktMS4xMi40Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmV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AgICAgICAgfTsKICAgICAgICAgICAgTC5jb250cm9sLmxheWVycygKICAgICAgICAgICAgICAgIGxheWVyX2NvbnRyb2xfOGI4NjJjYzE3NGM0NDJiZjlkZWU3ZGI3MDczOTdiNGMuYmFzZV9sYXllcnMsCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzhiODYyY2MxNzRjNDQyYmY5ZGVlN2RiNzA3Mzk3YjRjLm92ZXJsYXlzLAogICAgICAgICAgICAgICAge3Bvc2l0aW9uOiAndG9wcmlnaHQnLAogICAgICAgICAgICAgICAgIGNvbGxhcHNlZDogdHJ1ZSwKICAgICAgICAgICAgICAgICBhdXRvWkluZGV4OiB0cnVlCiAgICAgICAgICAgICAgICB9KS5hZGRUbyhtYXBfMzU4MzBiZmMzMGM1NDk1ZDhlNDIxODc5ZWFkNGNiM2MpOwogICAgICAgICAgICAKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f0972c08a20>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 49
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "BcKLdbV6HkG1",
        "colab_type": "text"
      },
      "source": [
        "To make a composite which maximizes an arbitrary band in the input, use **imageCollection.qualityMosaic()**. The **qualityMosaic()** method sets each pixel in the composite based on which image in the collection has a maximum value for the specified band. For example, the following code demonstrates making a greenest pixel composite and a recent value composite:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "7-n5llfgHrfN",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 700
        },
        "outputId": "e7fb1e1c-047b-43a7-c874-63b870b3cce7"
      },
      "source": [
        "# This function masks clouds in Landsat 8 imagery.\n",
        "def maskClouds(img):\n",
        "  scored = ee.Algorithms.Landsat.simpleCloudScore(img)\n",
        "  return img.updateMask(scored.select(['cloud']).lt(20))\n",
        "\n",
        "\n",
        "# This function masks clouds and adds quality bands to Landsat 8 images.\n",
        "def addQualityBands(img):\n",
        "  return maskClouds(img).addBands(img.normalizedDifference(['B5', 'B4']))\\\n",
        "                          .addBands(img.metadata('system:time_start')) # time in days\n",
        "\n",
        "\n",
        "# Load a 2014 Landsat 8 ImageCollection.\n",
        "# Map the cloud masking and quality band function over the collection.\n",
        "collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')\\\n",
        "               .filterDate('2014-06-01', '2014-12-31')\\\n",
        "               .map(addQualityBands)\n",
        "\n",
        "# Create a cloud-free, most recent value composite.\n",
        "recentValueComposite = collection.qualityMosaic('system:time_start')\n",
        "\n",
        "# Create a greenest pixel composite.\n",
        "greenestPixelComposite = collection.qualityMosaic('nd')\n",
        "\n",
        "\n",
        "# Create a cloudy image in the collection.\n",
        "cloudy = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140825');\n",
        "\n",
        "# Display the results.\n",
        "center = [37.8239, -122.374] # San Francisco Bay\n",
        "vizParams = {'bands': ['B5', 'B4', 'B3'], 'min': 0, 'max': 0.4}\n",
        "dicc = {'recent value composite':recentValueComposite.getMapId(vizParams),\n",
        "        'greenest pixel composite':greenestPixelComposite.getMapId(vizParams),\n",
        "        'cloudy':cloudy.getMapId(vizParams)}\n",
        "\n",
        "Mapdisplay(center,dicc,zoom_start=12)"
      ],
      "execution_count": 52,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFs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Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF82NWY2NjA5NzAxYmU0MjI4YTRlMTFlZTFmMWU0YmRkNSIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfNjVmNjYwOTcwMWJlNDIyOGE0ZTExZWUxZjFlNGJkZDUgPSBMLm1hcCgKICAgICAgICAnbWFwXzY1ZjY2MDk3MDFiZTQyMjhhNGUxMWVlMWYxZTRiZGQ1JywgewogICAgICAgIGNlbnRlcjogWzM3LjgyMzksIC0xMjIuMzc0XSwKICAgICAgICB6b29tOiAxMiwKICAgICAgICBtYXhCb3VuZHM6IGJvdW5kcywKICAgICAgICBsYXllcnM6IFtdLAogICAgICAgIHdvcmxkQ29weUp1bXA6IGZhbHNlLAogICAgICAgIGNyczogTC5DUlMuRVBTRzM4NTcsCiAgICAgICAgem9vbUNvbnRyb2w6IHRydWUsCiAgICAgICAgfSk7CgoKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNmE3Y2EyNDhhMjQxNGUxNmEwNTlmMTQwOGMzYzRmYTkgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRk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Jhc2VfbGF5ZXJzIDogeyAib3BlbnN0cmVldG1hcCIgOiB0aWxlX2xheWVyXzZhN2NhMjQ4YTI0MTRlMTZhMDU5ZjE0MDhjM2M0ZmE5LCB9LAogICAgICAgICAgICAgICAgb3ZlcmxheXMgOiB7ICJyZWNlbnQgdmFsdWUgY29tcG9zaXRlIiA6IHRpbGVfbGF5ZXJfOGY5YWFlNWU2YTQ3NGQzMmFlNmQ5YWJlN2E2YjI0ZTEsImdyZWVuZXN0IHBpeGVsIGNvbXBvc2l0ZSIgOiB0aWxlX2xheWVyX2Y2Mzc3NjYyNjI1ZjRkZTNiMTNkNmYwYjUwNzFmM2EzLCJjbG91ZHkiIDogdGlsZV9sYXllcl84NjBjZjhkZmRlZGM0MzIyYmE2OTU4ZTdhMzM0MjA5YiwgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgTC5jb250cm9sLmxheWVycygKICAgICAgICAgICAgICAgIGxheWVyX2NvbnRyb2xfZDA4OTVkZDUxZGEyNGUwNGJkYTM0ZTgwNWEzZWMzYmYuYmFzZV9sYXllcnMsCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sX2QwODk1ZGQ1MWRhMjRlMDRiZGEzNGU4MDVhM2VjM2JmLm92ZXJsYXlzLAogICAgICAgICAgICAgICAge3Bvc2l0aW9uOiAndG9wcmlnaHQnLAogICAgICAgICAgICAgICAgIGNvbGxhcHNlZDogdHJ1ZSwKICAgICAgICAgICAgICAgICBhdXRvWkluZGV4OiB0cnVlCiAgICAgICAgICAgICAgICB9KS5hZGRUbyhtYXBfNjVmNjYwOTcwMWJlNDIyOGE0ZTExZWUxZjFlNGJkZDUpOwogICAgICAgICAgICAKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f09713bcb00>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 52
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "V-F1RE7bKvaw",
        "colab_type": "text"
      },
      "source": [
        "# 7. Iterating over an ImageCollection\n",
        "\n",
        "Although `map()` applies a function to every image in a collection, the function visits every image in the collection independently. For example, suppose you want to compute a cumulative anomaly ($A_t$) at time t from a time series. To obtain a recursively defined series of the form $A_t = f(Image_t, A_{t-1})$, mapping won't work because the function (f) depends on the previous result ($A{t-1}$). \n",
        "\n",
        "For example, suppose you want to compute a series of cumulative Normalized Difference Vegetation Index (NDVI) anomaly images relative to a baseline. Let $A_0 = 0$ and $f(Image_t, A_{t-1}) = Image_t + A_{t-1}$ where $A_{t-1}$ is the cumulative anomaly up to time $t-1$ and Image_t is the anomaly at time t. Use **imageCollection.iterate()** to make this recursively defined ImageCollection. In the following example, the function **accumulate()** takes two parameters: an image in the collection, and a list of all the previous outputs. With each call to **iterate()**, the anomaly is added to the running sum and the result is added to the list. The final result is passed to the **ImageCollection** constructor to get a new sequence of images:\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "EdSJozzrL5-n",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 700
        },
        "outputId": "3365f0e7-b850-47e8-cb8d-c28c40a0b076"
      },
      "source": [
        "# Load MODIS EVI imagery.\n",
        "collection = ee.ImageCollection('MODIS/006/MYD13A1').select('EVI');\n",
        "\n",
        "# Define reference conditions from the first 10 years of data.\n",
        "reference = collection.filterDate('2001-01-01', '2010-12-31')\\\n",
        "                      .sort('system:time_start', False) # Sort chronologically in descending order.\n",
        "\n",
        "# Compute the mean of the first 10 years.\n",
        "mean = reference.mean()\n",
        "\n",
        "# Compute anomalies by subtracting the 2001-2010 mean from each image in a\n",
        "# collection of 2011-2014 images. Copy the date metadata over to the\n",
        "# computed anomaly images in the new collection.\n",
        "series = collection.filterDate('2011-01-01', '2014-12-31')\\\n",
        "                   .map(lambda img: img.subtract(mean).set('system:time_start', img.get('system:time_start')))\n",
        "\n",
        "# Display cumulative anomalies.\n",
        "center = [40.2,-100.811]\n",
        "vizParams = {'min': -60000, 'max': 60000, 'palette': ['FF0000', '000000', '00FF00']}\n",
        "dicc = {'EVI anomaly':series.sum().getMapId(vizParams)}\n",
        "Mapdisplay(center,dicc,zoom_start=5)"
      ],
      "execution_count": 54,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS40LjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktMS4xMi40Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpb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2YXIgdGlsZV9sYXllcl9hZDI5YzlhOGJkMjE0MDZlODQyZTM0MmVjODRkYzNlNCA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9KS5hZGRUbyhtYXBfOTFiOGYzYTIzNzU5NDM5YTkyNzIwYWY0ZmZmNjNmOTcpOwogICAgdmFyIHRpbGVfbGF5ZXJfYTAxZDMxOTU1YzJhNGE4ZWJkNmY3NDVjZTI1ZTk4YmYgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly9lYXJ0aGVuZ2luZS5nb29nbGVhcGlzLmNvbS9tYXAvNzYyZDM1YjAyMmIwYTdmZTk0YTFhZTQ5NmU4ZDM5ODIve3p9L3t4fS97eX0/dG9rZW49MDhmNjc4MTA4YjQzODcyMzBkN2ViOWFhYmE2ZjYwNjYnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiAiR29vZ2xlIEVhcnRoIEVuZ2luZSIsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9KS5hZGRUbyhtYXBfOTFiOGYzYTIzNzU5NDM5YTkyNzIwYWY0ZmZmNjNmOTcpOwogICAgCiAgICAgICAgICAgIHZhciBsYXllcl9jb250cm9sXzk4YjgyNjU0Y2NhZTQ4MGI4YjhkMDI2ZTQ4MGUyM2E3ID0gewogICAgICAgICAgICAgICAgYmFzZV9sYXllcnMgOiB7ICJvcGVuc3RyZWV0bWFwIiA6IHRpbGVfbGF5ZXJfYWQyOWM5YThiZDIxNDA2ZTg0MmUzNDJlYzg0ZGMzZTQsIH0sCiAgICAgICAgICAgICAgICBvdmVybGF5cyA6IHsgIkVWSSBhbm9tYWx5IiA6IHRpbGVfbGF5ZXJfYTAxZDMxOTU1YzJhNGE4ZWJkNmY3NDVjZTI1ZTk4YmYsIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEwuY29udHJvbC5sYXllcnMoCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzk4YjgyNjU0Y2NhZTQ4MGI4YjhkMDI2ZTQ4MGUyM2E3LmJhc2VfbGF5ZXJzLAogICAgICAgICAgICAgICAgbGF5ZXJfY29udHJvbF85OGI4MjY1NGNjYWU0ODBiOGI4ZDAyNmU0ODBlMjNhNy5vdmVybGF5cywKICAgICAgICAgICAgICAgIHtwb3NpdGlvbjogJ3RvcHJpZ2h0JywKICAgICAgICAgICAgICAgICBjb2xsYXBzZWQ6IHRydWUsCiAgICAgICAgICAgICAgICAgYXV0b1pJbmRleDogdHJ1ZQogICAgICAgICAgICAgICAgfSkuYWRkVG8obWFwXzkxYjhmM2EyMzc1OTQzOWE5MjcyMGFmNGZmZjYzZjk3KTsKICAgICAgICAgICAgCiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
            ],
            "text/plain": [
              "<folium.folium.Map at 0x7f09713bc630>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 54
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "lLmjL0bdMvOE",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Get the timestamp from the most recent image in the reference collection.\n",
        "time0 = reference.first().get('system:time_start')\n",
        "\n",
        "# Use imageCollection.iterate() to make a collection of cumulative anomaly over time.\n",
        "# The initial value for iterate() is a list of anomaly images already processed.\n",
        "# The first anomaly image in the list is just 0, with the time0 timestamp.\n",
        "first = ee.List([ee.Image(0).set('system:time_start', time0).select([0], ['EVI'])]) # Rename the first band 'EVI'.\n",
        "\n",
        "# This is a function to pass to Iterate().\n",
        "# As anomaly images are computed, add them to the list.\n",
        "def accumulate(img,lista):\n",
        "  # Get the latest cumulative anomaly image from the end of the list with\n",
        "  # get(-1).  Since the type of the list argument to the function is unknown,\n",
        "  # it needs to be cast to a List.  Since the return type of get() is unknown,\n",
        "  # cast it to Image.\n",
        "  img = ee.Image(img)\n",
        "  previous = ee.Image(ee.List(lista).get(-1))\n",
        "  # Add the current anomaly to make a new cumulative anomaly image.\n",
        "  added = img.add(previous)\\\n",
        "               .set('system:time_start', img.get('system:time_start')) # Propagate metadata to the new image.\n",
        "  # Return the list with the cumulative anomaly inserted.\n",
        "  return ee.List(lista).add(added)\n",
        "\n",
        "# Create an ImageCollection of cumulative anomaly images by iterating.\n",
        "# Since the return type of iterate is unknown, it needs to be cast to a List.\n",
        "cumulative = ee.ImageCollection(ee.List(series.iterate(accumulate, first)))"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "TOOglazRMxnr",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "def stackCollection(collection):\n",
        "  # Create an initial image.\n",
        "  first = ee.Image(collection.first()).select([])\n",
        "\n",
        "  # Write a function that appends a band to an image.\n",
        "  def appendBands(image, previous):\n",
        "    return ee.Image(previous).addBands(image)\n",
        "  return ee.Image(collection.iterate(appendBands, first))"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "cM9Qg9iTM0o6",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 269
        },
        "outputId": "bf76bdca-4937-4e48-ad00-02e12565991d"
      },
      "source": [
        "import numpy as np\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "# Chart some interesting locations.\n",
        "pt1 = ee.Geometry.Point(116.4647, 40.1054)\n",
        "\n",
        "# ee.ImageCollection to ee.Image\n",
        "img_cumulative = stackCollection(cumulative)\n",
        "\n",
        "\n",
        "series = img_cumulative.reduceRegions(collection=pt1,\n",
        "                                      reducer=ee.Reducer.mean(),\n",
        "                                      scale=500)\n",
        "\n",
        "dic_series = series.getInfo()\n",
        "EVI_anom = np.array(list(dic_series['features'][0]['properties'].values()))\n",
        "\n",
        "plt.plot(EVI_anom)\n",
        "plt.show()"
      ],
      "execution_count": 58,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY8AAAD8CAYAAACPWyg8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl8VNX5+PHPM2t2IBDWREA2DYio\nAVG7WEVF2xrcKrYqbW21rbYu3bR+f9XW8q12s3WpVsVvsbVFtFpwF8WqtVVZBGQTAogEQUAC2Uhm\nO78/5k5yk0wyGbLcm+R5v155OXPunZnDvMZ55jzPOeeKMQallFIqHR6nO6CUUqrn0eChlFIqbRo8\nlFJKpU2Dh1JKqbRp8FBKKZU2DR5KKaXSpsFDKaVU2jR4KKWUSpsGD6WUUmnzOd2BrjJo0CAzatQo\np7uhlFI9yooVK/YZYwpSnddrg8eoUaNYvny5091QSqkeRUS2t+c8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0MBzI\nBmY62qluoMGjqZ1Ake1+odXWp4iIn3jgeNQY86TV/LGIDLOODwP2ONW/bnYKcK6IfEA8jXka8Xx/\nfytFAX3vc1IOlBtj3rbuP0E8mPTVz8gMYJsxZq8xJgw8Sfxz06s/Ixo8mloGjLNmSQSIF70WO9yn\nbmXl8+cBG4wxv7MdWgzMsW7PARZ1d9+cYIy5yRhTaIwZRfzzsNQY8xXgVeBC67Q+834AGGN2AztE\nZILVdDqwnj76GSGerpouIlnW/z+J96NXf0Z0kWAzInIO8Ry3F3jYGDPX4S51KxH5FPAG8B6NOf6f\nEK97LASOIL5b8ZeMMfsd6aRDRORU4AfGmC+IyJHERyL5wLvApcaYeif7151EZArxCQQBYCvwNeI/\nRvvkZ0REfgZcTHy24rvAN4jXOHrtZ0SDh1JKqbRp2koppVTaNHgopZRKmwYPpZRSadPgoZRSKm0a\nPJRSSqVNg4dSSqm0afBQSimVNg0eSiml0vb/AX7awHga8UUUAAAAAElFTkSuQmCC\n",
            "text/plain": [
              "<Figure size 432x288 with 1 Axes>"
            ]
          },
          "metadata": {
            "tags": []
          }
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "yS9KAy82NQqK",
        "colab_type": "text"
      },
      "source": [
        "<!--NAVIGATION-->\n",
        " < [Image](2_eeImage.ipynb) | [Contents](index.ipynb) |  [Geometry, Feature and FeatureCollection](4_features.ipynb)>\n",
        "\n",
        "<a href=\"https://colab.research.google.com/github/csaybar/EEwPython/blob/master/3_eeImageCollection.ipynb\"><img align=\"left\" src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open in Colab\" title=\"Open and Execute in Google Colaboratory\"></a>"
      ]
    }
  ]
}